﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mani.Common;

namespace RastinArgham.CRM.Business
{
    public partial class User
    {
        public String PersianCreateDate
        {
            get { return this.aspnet_Membership.CreateDate.ToJalali(); }
        }

        public String Email
        {
            get { return this.aspnet_Membership.Email; }
        }

        public bool IsLockedOut
        {
            get { return this.aspnet_Membership.IsLockedOut; }
        }

        public String RoleName
        {
            get
            {
                List<Roles> roles = this.aspnet_Roles.ToList();
                if (roles.Count == 0)
                    return String.Empty;

                string result = String.Empty;
                foreach (var item in roles)
                {
                    if (!String.IsNullOrEmpty(result))
                        result += ",";

                    result += item.RoleName;
                }

                return result;
            }
        }

        public String PersianLastActivityDate
        {
            get
            {
                return this.LastActivityDate.ToLocalTime().ToJalaliWithTime();
            }
        }
    }
}
